package cn.tedu.shoot;


import java.awt.image.BufferedImage;
import java.util.Random;

public abstract class FlyingObject {
    public static final int LIVE = 0;
    public static final int DEAD = 1;
    public static final int REMOVE = 2;
    protected int state = LIVE;


    protected int width;  //宽
    protected int height; //高
    protected int x;      //x坐标
    protected int y;      //y坐标

    /**
     * 给小大敌机、小蜜蜂提供
     */
    public FlyingObject(int width,int height){
        this.width = width;
        this.height = height;
        Random rand = new Random();
        x = rand.nextInt(World.WIDTH-width);
        y = -height;
    }

    /**
     * 专门给英雄机、天空、子弹提供的
     */
     public FlyingObject(int width,int height,int x,int y){
         this.width = width;
         this.height = height;
         this.x = x;
         this.y = y;
     }

     public abstract BufferedImage getImage();

     public boolean isLive(){
         return state==LIVE;
     }

     public boolean isDead(){
         return state==DEAD;
    }

    public boolean isRemove(){
         return state==REMOVE;
    }
}
